<!--
  @description 开放签

  Copyright (C) [2025] [版权所有者（北京资源律动科技有限公司）]. All rights reserved.

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with this program.  If not, see <https://www.gnu.org/licenses/>.

  注意：本代码基于 AGPLv3 协议发布。若通过网络提供服务（如 Web 应用），
  必须公开修改后的完整源码（包括衍生作品），详见协议全文。
-->

<template>
  <div :class="[prefixCls, getLayoutContentMode, getMenuClass()]" v-loading="getOpenPageLoading && getPageLoading">
    <PageLayout />
  </div>
</template>
<script lang="ts">
  import { defineComponent } from 'vue';
  import PageLayout from '/@/layouts/page/index.vue';
  import { useDesign } from '/@/hooks/web/useDesign';
  import { useRootSetting } from '/@/hooks/setting/useRootSetting';
  import { useTransitionSetting } from '/@/hooks/setting/useTransitionSetting';
  import { useContentViewHeight } from './useContentViewHeight';
  import { useMenuSetting } from '/@/hooks/setting/useMenuSetting';
  import { useHeaderSetting } from '/@/hooks/setting/useHeaderSetting';
  import { useFullContent } from '/@/hooks/web/useFullContent';

  export default defineComponent({
    name: 'LayoutContent',
    components: { PageLayout },
    setup() {
      const { prefixCls } = useDesign('layout-content');
      const { getOpenPageLoading } = useTransitionSetting();
      const { getShowSidebar } = useMenuSetting();
      const { getFullContent } = useFullContent();
      const { getShowFullHeaderRef } = useHeaderSetting();
      const { getLayoutContentMode, getPageLoading } = useRootSetting();
      useContentViewHeight();
      function getMenuClass(){
        let result = "";
        if(!getShowSidebar.value){
          if(!getShowFullHeaderRef.value){
            result = "menu-top0";
          }else{
            result= "no-menu-tab";
          }
        }else{
          if(getFullContent){
              return 'full-content'
          }
        }
        return result;
      }
      
      return {
        prefixCls,
        getOpenPageLoading,
        getLayoutContentMode,
        getPageLoading,
        getShowSidebar,
        getShowFullHeaderRef,getMenuClass
      };
    },
  });
</script>
<style lang="less">
  @prefix-cls: ~'@{namespace}-layout-content';

  .@{prefix-cls} {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    // padding:24px;
    margin-top:@multiple-height + 2 + 63;

    &.fixed {
      width: 1200px;
      margin: 0 auto;
    }
    &.full{
      margin-top:@multiple-height + 30;
    }

    &-loading {
      position: absolute;
      top: 200px;
      z-index: @page-loading-z-index;
    }
    &.no-menu-tab{
      margin-top:@header-height;
    }
    &.menu-top0{
      margin-top:0;
    }
  }
</style>
